﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pay.Data {
    public partial class TokenBillDetailMap
    : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<TokenBillDetail> {
        public TokenBillDetailMap() {
            ToTable("mc_TokenBillDetail", "dbo");

            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.Commission)
                .HasColumnName("Commission")
                .HasPrecision(18, 6)
                .IsRequired();
            Property(t => t.Proportion)
                .HasColumnName("Proportion")
                .HasPrecision(18, 2)
                .IsRequired();
            HasRequired(t => t.Merchant)
                .WithMany()
                .HasForeignKey(d => d.MerchantId)
                .WillCascadeOnDelete(false);
            HasRequired(t => t.InviteMerchant)
                .WithMany()
                .HasForeignKey(d => d.InviteMerchantId)
                .WillCascadeOnDelete(false);
            HasOptional(t=>t.TokenBill)
                .WithMany()
                .HasForeignKey(t=>t.TokenBillId)
                .WillCascadeOnDelete(false);
        }
    }
}
